<template>
    <div style="background: #eee; padding: 20px" >
      <Card :bordered="false">
        <p slot="title" style="text-align: center">{{billname}}</p>
        <div>
          <Row justify="start">
            <Col span="4">出库日期:{{ dates }}</Col>
            <Col span="4">出库单号:{{ didn }}</Col>
            <Col span="2">出库人:{{ staff }}</Col>
          </Row>
          <Divider />
          <Table
            :columns="columns15"
            :data="data11"
            border
          ></Table>
           <Table
            :show-header="false"
            :columns="columns16"
            :data="datasum"
            border
          ></Table>
        </div>
      </Card>
    </div>
</template>
<script>
export default {
  data() {
    return {
      modal11:false,
      dates: "2021-05-06",
      didn: "20210506tx",
      ss:false,
      billname:"Xxx",
      datasum:[],
      staff: sessionStorage.getItem("user"),
      columns15: [
        {
          type: "index",
          width: 100,
          align: "center",
        },
        {
          title: "仓库",
          key: "sid",
          align: "center",
        },
        {
          title: "作物",
          key: "name",
          align: "center",
        },
        {
          title: "批次",
          key: "batch",
          align: "center",
        },
        {
          title: "数量",
          key: "num",
          align: "center",
        },
        {
          title: "单价",
          key: "price",
          align: "center",
        },
        {
          title: "合计总价",
          key: "total",
          align: "center",
        },
      ],
      columns16: [
        {
          title:"合计",
          key:"sum",
          align: "center",
        },
        {
          title: "仓库",
          key: "sid",
          align: "center",
        },
        {
          title: "作物",
          key: "name",
          align: "center",
        },
        {
          title: "批次",
          key: "batch",
          align: "center",
        },
        {
          title: "数量",
          key: "num",
          align: "center",
        },
        {
          title: "单价",
          key: "price",
          align: "center",
        },
        {
          title: "合计总价",
          key: "total",
          align: "center",
        },
      ],
      data11: [
        {sid:"xxx",name:"hh",batch:"2020",num:20,price:20,total:40},
        {sid:"ddd",name:"HH",batch:"2020",num:20,price:20,total:40}
        ],
    };
  },
  mounted() {
    var today = new Date();
    var y = today.getFullYear();
    var m = today.getMonth() + 1;
    var d = today.getDate();
    m = m < 10 ? "0" + m : m;
    d = d < 10 ? "0" + d : d;
    this.dates = y + "-" + m + "-" + d;
    var count=0
    var Tt=0
    var row=this.data11[1]
       for(var i in this.data11){
          row=this.data11[i]
          count+=row.num
          Tt+=row.total
       }
    var l=this.data11.length
    this.datasum=[{sum:"合计",sid:" ",name:" ",batch:" ",num:count,price:" ",total:Tt}]
    console.log(this.datasum)
    
  },
 
  methods: {
   
  },
  watch:{
    data11:{
      handler(nd){
        
      },
      deep:true
    }
  }
};
</script>
